@include('admin.layout.css')
@include('admin.layout.js')




<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

    <div class="layui-form-item">
        <label class="layui-form-label">商家名称</label>
        <div class="layui-input-block">
            <input type="text"  name="shop_name" value="{{$info['shop_name']}}"  placeholder="请输入商家名称" autocomplete="off" class="layui-input" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商家联系手机号</label>
        <div class="layui-input-block">
            <input type="text"  name="shop_phone" value="{{$info['shop_phone']}}"  placeholder="请输入商家联系手机号" autocomplete="off" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">抽佣类型</label>
        <div class="layui-input-block">
            <input type="radio" lay-filter="shop_type" name="shop_type" value="1" disabled title="统一抽佣" @if($info['shop_type'] == 1)checked @endif>
{{--            <input type="radio" lay-filter="shop_type" name="shop_type" value="2" disabled title="商品单独抽佣" @if($info['shop_type'] == 2)checked @endif>--}}
        </div>
    </div>

    @if($info['shop_type'] == 1)
        <div class="layui-form-item" id="show_input">
            <label class="layui-form-label">商家统一抽佣(小于1)</label>
            <div class="layui-input-block">
                <input type="text" @if($info['status'] != 0 && $info['status'] != 401)disabled @endif  name="shop_value_yong" value="{{$info['shop_value_yong']}}"  placeholder="请输入商家统一抽佣" autocomplete="off" class="layui-input" >
            </div>
        </div>
    @endif



    <div class="layui-form-item">
        <label class="layui-form-label">代理用户id</label>
        <div class="layui-input-inline">
            <input type="text"  name="user_daili_id" value="{{$info['user_daili_id']}}"  placeholder="请输入代理用户id" autocomplete="off" class="layui-input" >
        </div>


        <label class="layui-form-label">销售奖</label>
        <div class="layui-input-inline">
            <input type="text"  name="xiaoshoujiang" value="{{$info['xiaoshoujiang']}}"  placeholder="请输入销售奖" autocomplete="off" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">点位奖</label>
        <div class="layui-input-inline">
            <input type="text"  name="point_uid_price"  value="{{$info['point_uid_price']}}" placeholder="请输入点位奖" autocomplete="off" class="layui-input" >
        </div>


        <label class="layui-form-label">点位上级奖</label>
        <div class="layui-input-inline">
            <input type="text"  name="point_uid_two_price" value="{{$info['point_uid_two_price']}}"  placeholder="请输入点位上级奖" autocomplete="off" class="layui-input" >
        </div>
    </div>
    <input type="hidden" name="shop_id" value="{{$info['shop_id']}}">
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="submit" id="submit" value="确认">
        <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="取消">
    </div>

</div>


<script>



    layui.use(['laydate','form'], function() {
        let form = layui.form;

        form.on('radio(shop_type)', function(data){
            if(data.value == '1'){
                $("#show_input").css('display','')
            }else{
                $("#show_input").css('display','none')
            }
        });
        form.on('submit(submit)', function(data){
            if(data.field['shop_type'] == 2){
                data.field['shop_value_yong'] = 0;
            }

            Api.add("{{route('admin.shop.edit')}}",data.field,function(res){
                if (res.code !== 200){
                    Utils.errorToast(res.msg);
                    return;
                }
            });
        });


    });
</script>
